;(function($) {
  var myflow = $.myflow

  //重新设置节点框的属性
  $.extend(true, myflow.config.rect, {
    attr: {
      r: 8,
      fill: '#F6F7FF',
      stroke: '#03689A',
      'stroke-width': 2
    }
  })

  //定义流程的属性
  $.extend(true, myflow.config.props.props, {
    flow: {
      name: 'flow',
      label: 'flow',
      value: '',
      editor: function() {
        return new myflow.editors.readEditor()
      }
    },
    name: {
      name: 'name',
      label: '名称',
      value: '',
      editor: function() {
        return new myflow.editors.inputEditor()
      }
    }
  })

  $.extend(true, myflow.config.tools.states, {
    start: {
      showType: 'image',
      type: 'start',
      name: { text: '<<start>>' },
      text: { text: '开始' },
      img: { src: '/static/plugins/myflow/img/48/start_event_empty.png', width: 48, height: 48 },
      attr: { width: 50, heigth: 50 },
      props: {
        id: {
          name: 'id',
          label: 'Id',
          value: '',
          editor: function() {
            return new myflow.editors.readEditor()
          }
        },
        text: {
          name: 'text',
          label: '名称',
          editor: function() {
            return new myflow.editors.textEditor()
          },
          value: '开始'
        },
        // zhanglongfei modify
        // nodetype: {name:'nodetype', label : '类型', value:'0', editor: function(){return new myflow.editors.selectEditor([{name:'开始节点',value:0}]);}}
        nodetype: {
          name: 'nodetype',
          label: '类型',
          value: '0',
          editor: function() {
            return [{ name: '开始节点', value: 0 }]
          }
        }
      }
    },
    end: {
      showType: 'image',
      type: 'end',
      name: { text: '<<end>>' },
      text: { text: '结束' },
      img: { src: '/static/plugins/myflow/img/48/end_event_terminate.png', width: 48, height: 48 },
      attr: { width: 50, heigth: 50 },
      props: {
        id: {
          name: 'id',
          label: 'Id',
          value: '',
          editor: function() {
            return new myflow.editors.readEditor()
          }
        },
        text: {
          name: 'text',
          label: '名称',
          editor: function() {
            return new myflow.editors.textEditor()
          },
          value: '结束'
        },
        // zhanglongfei modify
        // nodetype: {name:'nodetype', label : '类型', value:'9', editor: function(){return new myflow.editors.selectEditor([{name:'结束节点',value:9}]);}}
        nodetype: {
          name: 'nodetype',
          label: '类型',
          value: '9',
          editor: function() {
            return [{ name: '结束节点', value: 9 }]
          }
        }
      }
    },
    task: {
      showType: 'text',
      type: 'task',
      name: { text: '<<task>>' },
      text: { text: '任务' },
      img: { src: '/static/plugins/myflow/img/48/task_empty.png', width: 48, height: 48 },
      props: {
        id: {
          name: 'id',
          label: 'Id',
          value: '',
          editor: function() {
            return new myflow.editors.readEditor()
          }
        },
        text: {
          name: 'text',
          label: '名称',
          editor: function() {
            return new myflow.editors.textEditor()
          },
          value: '任务'
        },
        // zhanglongfei modify
        // nodetype: {name:'nodetype', label : '类型', value:'1', editor: function(){return new myflow.editors.selectEditor([{name:'单人节点',value:1},{name:'竞争节点',value:2},{name:'等待节点',value:3},{name:'会签等待',value:4},{name:'自循环竞争',value:5}]);}}
        nodetype: {
          name: 'nodetype',
          label: '类型',
          value: '1',
          editor: function() {
            return [{ name: '单人节点', value: 1 }, { name: '竞争节点', value: 2 }, { name: '会签节点', value: 3 }, { name: '会签等待节点', value: 4 }, { name: '自循环竞争', value: 5 }]
          }
        }
      }
    },

    fork: {
      showType: 'text45',
      type: 'fork',
      name: { text: '<<fork>>' },
      text: { text: '分支' },
      img: { src: '/static/plugins/myflow/img/48/gateway_parallel.png', width: 48, height: 48 },
      attr: { width: 50, heigth: 50 },
      props: {
        id: {
          name: 'id',
          label: 'Id',
          value: '',
          editor: function() {
            return new myflow.editors.readEditor()
          }
        },
        text: {
          name: 'text',
          label: '名称',
          editor: function() {
            return new myflow.editors.textEditor()
          },
          value: '分支'
        },
        // zhanglongfei modify
        // nodetype: {name:'nodetype', label : '类型', value:'6', editor: function(){return new myflow.editors.selectEditor([{name:'分支',value:6}]);}}
        nodetype: {
          name: 'nodetype',
          label: '类型',
          value: '6',
          editor: function() {
            return [{ name: '分支', value: 6 }]
          }
        }
      }
    },
    join: {
      showType: 'text45',
      type: 'join',
      name: { text: '<<join>>' },
      text: { text: '合并' },
      img: { src: '/static/plugins/myflow/img/48/task_wait.png', width: 48, height: 48 },
      attr: { width: 50, heigth: 50 },
      props: {
        id: {
          name: 'id',
          label: 'Id',
          value: '',
          editor: function() {
            return new myflow.editors.readEditor()
          }
        },
        text: {
          name: 'text',
          label: '名称',
          editor: function() {
            return new myflow.editors.textEditor()
          },
          value: '合并'
        },
        // zhanglongfei modify
        // nodetype: {name:'nodetype', label : '类型', value:'7', editor: function(){return new myflow.editors.selectEditor([{name:'合并',value:7}]);}}
        nodetype: {
          name: 'nodetype',
          label: '类型',
          value: '7',
          editor: function() {
            return [{ name: '合并', value: 7 }]
          }
        }
      }
    },
    //往后节点类型暂时用不着
    state: {
      showType: 'text',
      type: 'state',
      name: { text: '<<state>>' },
      text: { text: '状态' },
      img: { src: '/static/plugins/myflow/img/48/task_empty.png', width: 48, height: 48 },
      props: {
        text: {
          name: 'text',
          label: '显示',
          editor: function() {
            return new myflow.editors.textEditor()
          },
          value: '状态'
        },
        temp1: {
          name: 'temp1',
          label: '文本',
          value: '',
          editor: function() {
            return new myflow.editors.inputEditor()
          }
        },
        temp2: {
          name: 'temp2',
          label: '选择',
          value: '',
          editor: function() {
            return new myflow.editors.selectEditor([{ name: 'aaa', value: 1 }, { name: 'bbb', value: 2 }])
          }
        }
      }
    },
    'end-cancel': {
      showType: 'image',
      type: 'end-cancel',
      name: { text: '<<end-cancel>>' },
      text: { text: '取消' },
      img: { src: '/static/plugins/myflow/img/48/end_event_cancel.png', width: 48, height: 48 },
      attr: { width: 50, heigth: 50 },
      props: {
        text: {
          name: 'text',
          label: '显示',
          editor: function() {
            return new myflow.editors.textEditor()
          },
          value: '取消'
        },
        temp1: {
          name: 'temp1',
          label: '文本',
          value: '',
          editor: function() {
            return new myflow.editors.inputEditor()
          }
        },
        temp2: {
          name: 'temp2',
          label: '选择',
          value: '',
          editor: function() {
            return new myflow.editors.selectEditor([{ name: 'aaa', value: 1 }, { name: 'bbb', value: 2 }])
          }
        }
      }
    },
    'end-error': {
      showType: 'image',
      type: 'end-error',
      name: { text: '<<end-error>>' },
      text: { text: '错误' },
      img: { src: '/static/plugins/myflow/img/48/end_event_error.png', width: 48, height: 48 },
      attr: { width: 50, heigth: 50 },
      props: {
        text: {
          name: 'text',
          label: '显示',
          editor: function() {
            return new myflow.editors.textEditor()
          },
          value: '错误'
        },
        temp1: {
          name: 'temp1',
          label: '文本',
          value: '',
          editor: function() {
            return new myflow.editors.inputEditor()
          }
        },
        temp2: {
          name: 'temp2',
          label: '选择',
          value: '',
          editor: function() {
            return new myflow.editors.selectEditor([{ name: 'aaa', value: 1 }, { name: 'bbb', value: 2 }])
          }
        }
      }
    }
  })
})(jQuery)
